<?php
/**
 * Created by PhpStorm.
 * User: wanglong
 * Date: 2017/11/17
 * Time: 21:04
 */
$link=mysqli_connect('localhost','root','');
mysqli_set_charset($link,'utf8');
mysqli_select_db($link,'test');
$sql="select distinct year from history";
$res=mysqli_query($link,$sql);

?>
<!doctype html>
<html lang="en">
<head>
    <title>测试例子</title>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="http://www.yunyichong.com/statics/yyc/css/main.css?v=1.1">
    <link rel="stylesheet" href="http://www.yunyichong.com/statics/yyc/css/zxj.css?v=1.1">
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
    <script src="http://www.yunyichong.com/statics/yyc/js/slide.js"></script>
    <script src="http://www.yunyichong.com/statics/yyc/js/carousel.js"></script>
    <script src="http://www.yunyichong.com/statics/yyc/js/bootstrap.min.js"></script>

</head>
<body>
<div class="layout">
    <div class="about_main">
        <h3>
            <p class="content_title">发展历程</p>
            <i></i>
            <p>DEVELOPMENT COURSE</p>
        </h3>
        <ul class="about_course">

            <?php
                if($res){
                    while($rows=mysqli_fetch_assoc($res)){
            ?>
            <li>
                <h6><?php echo $rows['year'];?>年</h6>

                <?php
                    $sql2="select * from history where year=".$rows['year'];
                    $r=mysqli_query($link,$sql2);
                    if($r){
                        while ($data=mysqli_fetch_assoc($r)){
                        ?>
                        <div class="about_course_main clearfix">
                            <i class="about_course_time"><?php echo $data['month']?>月</i>
                            <p><?php echo $data['content'];?></p>
                            <i class="about_course_tips"></i>
                        </div>
                        <?php
                        }
                    }
                ?>
                <?php
                }
                }
                ?>

            </li>
            <span class="about_course_bg"></span>
            <script type="text/javascript">
                $('.about_course_main').each(function(){
                    var num = $(this).index();
                    if(num%2==0){
                        $(this).addClass('about_course_mainr');
                    }
                });
            </script>
        </ul>
        <a href="###" class="about_course_more">MORE</a>
    </div>
</div>




</body>
</html>
